
import axios from 'axios';

/**
 * 商品销售规格
 */
export class SpecificationStockService {
    // 分页查询列表
    static findSpecificationStocks (queryParams) {
        return axios({
            url: '/mall/good/SpecificationStock/findSpecificationStocks',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的商品销售规格
    static findSpecificationStock (specificationStockId) {
        const query = {
            specificationStockId
        }
        return axios({
            url: '/mall/good/SpecificationStock/findSpecificationStock',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的商品销售规格(包含外键名称)
    static findSpecificationStockForView (specificationStockId) {
        const query = {
            specificationStockId
        }
        return axios({
            url: '/mall/good/SpecificationStock/findSpecificationStockForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的商品销售规格(包含外键名称)
    static findSpecificationStockForEdit (specificationStockId) {
        const query = {
            specificationStockId
        }
        return axios({
            url: '/mall/good/SpecificationStock/findSpecificationStockForEdit',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的商品销售规格(只提取ID 和 Name)
    static findSpecificationStocksWithIdNameById (specificationStockId) {
        const query = {
            specificationStockId
        }
        return axios({
            url: '/mall/good/SpecificationStock/findSpecificationStocksWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询商品销售规格集合(只提取ID 和 Name)
    static findSpecificationStocksWithIdNameByName (specificationStockName) {
        const query = {
            specificationStockName
        }
        return axios({
            url: '/mall/good/SpecificationStock/findSpecificationStocksWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }

    //新增保存商品销售规格
    static saveSpecificationStock (specificationStock) {
        const query = {}
        return axios({
            url: '/mall/good/SpecificationStock/saveSpecificationStock',
            method: 'POST',
            params: query,
            data: specificationStock
        });
    }

    //修改保存商品销售规格
    static updateSpecificationStock (specificationStock) {
        const query = {}
        return axios({
            url: '/mall/good/SpecificationStock/updateSpecificationStock',
            method: 'POST',
            params: query,
            data: specificationStock
        });
    }

    //根据ID查询指定的商品销售规格(只提取ID 和 Name)
    static deleteSpecificationStock (specificationStockId) {
        const query = {
            specificationStockId
        }
        return axios({
            url: '/mall/good/SpecificationStock/deleteSpecificationStock',
            method: 'POST',
            params: query,
        });
    }
}
